Fix/dependent parameters obj methods#48110
Conversation
|
This PR doesn't have any linked issues. Please open an issue that references this PR. From there we can discuss and prioritise. |
|
|
||
| function getCandidateDiscriminantPropertyAccess(expr: Expression) { | ||
| if (isBindingPattern(reference) || isFunctionExpressionOrArrowFunction(reference)) { | ||
| if (isBindingPattern(reference) || isFunctionExpressionOrArrowFunction(reference) || isObjectLiteralMethod(reference)) { |
There was a problem hiding this comment.
There are still different function-like types - but I couldn't repro this with like class methods etc and for some types (like getters/setters it doesn't make sense in the first place).
The issue is manifesting itself only if parameters are declared in the most straightforward way, so like in here:
const obj = { method(a, b) {} }and when "dependent parameters" are flowing into them from an assignment to a particular type or something (there are no "inline" types declared for them). I couldn't reproduce this behavior with classes anyhow, nor with constructors - as param types don't seem to "flow" into them, they have to be declared explicitly. I might have missed some way to make those actually flow, maybe there is some combination of features that allows that I didn't think of 🤷♂️
fixes #47190 (comment) reported by @jcalz , fixes #48160
I've first committed the failing test case and then added a fix on top of that so you can exactly see what has changed for those new test cases:
27359b0...b15f40a